<?php

// +----------------------------------------------------------------------
// | ThinkAdmin
// +----------------------------------------------------------------------
// | 版权所有 2014~2019 广州楚才信息科技有限公司 [ http://www.cuci.cc ]
// +----------------------------------------------------------------------
// | 官方网站: http://demo.thinkadmin.top
// +----------------------------------------------------------------------
// | 开源协议 ( https://mit-license.org )
// +----------------------------------------------------------------------
// | gitee 代码仓库：https://gitee.com/zoujingli/ThinkAdmin
// | github 代码仓库：https://github.com/zoujingli/ThinkAdmin
// +----------------------------------------------------------------------

namespace app\market\controller;

use library\Controller;
use library\tools\Data;
use think\Console;
use think\Db;
use think\exception\HttpResponseException;

/**
 * 产品分类
 * Class Index
 * @package app\admin\controller
 */
class MarketType extends Controller
{
     protected $table = 'MarketType';

    /**
     * 产品分类列表
     * @auth true
     * @menu true
     */
    public function index()
    {
        $this->title = '产品分类';
        $query = $this->_query($this->table)->like('name')->equal('status');
        $query->order('sort ASC,id ASC')->page();
    }

    /**
     * 添加产品分类
     */
    public function marketTypeAdd()
    {   

        $this->title = '添加产品分类';
        $this->_form($this->table, 'market_type_add');
       
    }
    /**
     * 编辑产品分类
     */
    public function edit()
    {   

        $this->title = '编辑产品分类';
        $this->_form($this->table, 'market_type_add');
       
    }

     /**
       * 产品分类禁用
     */
     public function forbid()
    {
        $this->_save($this->table, ['status' => '0']);
    }

    /**
       * 产品分类启用
     */
    public function resume()
    {
        $this->_save($this->table, ['status' => '1']);
    }



}
